# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=binaryninja-python
pkgver=13.83f59f7
pkgrel=7
groups=('blackarch' 'blackarch-binary')
pkgdesc='Binary Ninja prototype written in Python.'
arch=('any')
url='https://github.com/Vector35/binaryninja-python'
license=('custom:unknown')
depends=('python2' 'python2-pyside' 'python2-pycryptodome' 'python2-pyqt4'
         'pyqt4-common' 'pyside2' 'qtwebkit')
makedepends=('git')
source=("git+https://github.com/Vector35/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" readme.md docs/*

  rm -rf readme.md docs/

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 binja.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

